package shuogg.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import shuogg.domain.User;

@Controller
@RequestMapping("/user")
public class CommandController {
    /* 这里可以指定method, 即POST和GET都可以访问该方法, 如果指定则默认为GET */
    @RequestMapping(value = "receiveUser", method = { RequestMethod.GET, RequestMethod.POST })
    public String addUser(User user, Model model) {
        model.addAttribute("myuserData", user);
        System.out.println(user);
        return "showResult";
    }

}
